﻿@using System.Globalization
@model Project.Domain.Entities.StoreSecure
@{
    var controller = ViewContext.Controller.ValueProvider.GetValue("controller").RawValue.ToString();
    ViewBag.Title = "Modify" + controller.ToString(CultureInfo.InvariantCulture);
    var id = Convert.ToInt32(ViewBag.Id);
    var StorePayto = "";
    var MachentStoreName = "";
    var SecureWord = "";
    if(Model!=null)
    {
         StorePayto = Model.ConfigStorePayto;
         MachentStoreName = Model.ConfigMachentStoreName;
         SecureWord = Model.ConfigSecureWord;
    }
}

@{
    ViewBag.Title = "Modify" + controller.ToString();
}
<script type="text/javascript">
    $(document).ready(function() {
        $('#date').datepicker({
            changeMonth: true,
            changeYear: true,
            dateFormat: 'dd-mm-yy',
            yearRange: '2011:2050'
        });
    });
    function save() {
        var options = {
            beforeSubmit: showRequest,  // pre-submit callback 
            success: showResponse  // post-submit callback 
        };
        $('#StorePayto').val();
        $('#MachentStoreName').val();
        $('#SecureWord').val();
        $('#frmManagement').ajaxSubmit(options);
    }

    function showRequest(formData, jqForm, options) {
        var form = jqForm[0];        
        if (form.StorePayto.value == '') {
            alert('Vui lòng điền đầy đủ thông tin.');
            return false;
        }
        if (form.MachentStoreName.value == '') {
            alert('Vui lòng điền đầy đủ thông tin.');
            return false;
        }
        if (form.SecureWord.value == '') {
            alert('Vui lòng điền đầy đủ thông tin.');
            return false;
        }
    }

    function showResponse(responseText, statusText, xhr, $form) {
        if (responseText == '1') {
            var url = root + "Admin/" + "@controller.ToString()" + "/#/save";
            location.href = url;
        }        
    }
</script>
<div class="table">
    <div class="head_table">
        <div class="head_title_edit">@controller</div>
    </div>
	<div class="clearAll"></div>
	@using (Html.BeginForm("Modify", "SecureStore", FormMethod.Post, new { id = "frmManagement" }))
    {
        <input type="hidden" value="@ViewBag.Id" name="hiddenIdAdmincp" />
        <div class="row_text_field_first">
            <table cellspacing="0" cellpadding="0" border="0" width="100%">
                <tr>
                    <td class="left_text_field">Status:</td>
                    <td class="right_text_field">                                                
                        <input type="checkbox" class="custom_chk" name="statusAdmincp" />                                               
                    </td>
                </tr>
            </table>
        </div>

        <div class="row_text_field">
            <table cellspacing="0" cellpadding="0" border="0" width="100%">
                <tr>
                    <td class="left_text_field">StorePayto:</td>
                    <td class="right_text_field">
                        <input type="text" class="" id="StorePayto" name="StorePayto" value="@StorePayto" style="width: 200px;" />
                    </td>
                </tr> 
            </table>
        </div>

        <div class="row_text_field">
            <table cellspacing="0" cellpadding="0" border="0" width="100%">
                <tr>
                    <td class="left_text_field">MerchantStoreName:</td>
                    <td class="right_text_field">
                        <input type="text" name="MachentStoreName" id="MachentStoreName" value="@MachentStoreName" style="width: 200px;"/>
                    </td>                                     
                </tr> 
         </table>
     </div>    
     <div class="row_text_field">
         <table cellspacing="0" cellpadding="0" border="0" width="100%">
             <tr>                 
                 <td class="left_text_field">SecureWord:</td>
                 <td class="right_text_field">
                     <input type="text" name="SecureWord" id="SecureWord" value="@SecureWord" style="width: 200px;"/>
                 </td>
             </tr> 
         </table>
     </div>                    
 }
</div>